package com.aliyun.edu.advanced.development.thread.achieve;

/**
 * @author xiaoming
 * @version 1.0
 * @date 2019-02-17 21:00
 **/
public class demo1 {
    public static void main(String[] args) {
        MyThread t1 = new MyThread("线程A");
        MyThread t2 = new MyThread("线程B");
        MyThread t3 = new MyThread("线程C");

        t1.start();
        t1.start();

        t1.run();
        t2.start();
        t3.start();

    }
}

/**
 * 一个线程的主体类
 */
class MyThread extends Thread {
    private String title;

    public MyThread(String title) {
        this.title = title;
    }

    // 所有线程从这里开始执行
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(this.title + ", i = " + i);
        }
    }
}